Skip to content

feat: add semantic tokens #2191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JannikLassahn
Copy link

Add integration for semantic tokens provided by @angular/language-service.
Only supports token type 'class' at the moment.

@JannikLassahn
Copy link
Author

Related to angular/angular#60260

@JannikLassahn JannikLassahn force-pushed the feature/semantic-tokens branch from 1819d82 to 1a2f94b Compare June 15, 2025 12:24
import * as ts from 'typescript/lib/tsserverlibrary';
import * as lsp from 'vscode-languageserver/node';

export enum TokenEncodingConsts {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind linking to the TS definitions like you did in angular/angular#60260? Context is pretty lost between the two sometimes

Comment on lines +53 to +62
function getTokenTypeFromClassification(tsClassification: number): number|undefined {
if (tsClassification > TokenEncodingConsts.modifierMask) {
return (tsClassification >> TokenEncodingConsts.typeOffset) - 1;
}
return undefined;
}

function getTokenModifierFromClassification(tsClassification: number) {
return tsClassification & TokenEncodingConsts.modifierMask;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wonder if this should really be something that the language service provides since it's so highly dependent on the offset and modifier mask actually matching what the language service returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants